﻿using PMSWenLvTing.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;

namespace PMSWenLvTing.Utility
{
    /// <summary>
    /// 通用帮助类
    /// </summary>
    public class CommonHelper
    {
        /// <summary>
        /// 获取返回的结果model
        /// </summary>
        /// <param name="code"></param>
        /// <param name="msg"></param>
        /// <param name="needLogin"></param>
        /// <param name="dataStr"></param>
        /// <returns></returns>
        public static DTO_Res Self_GetRes(int code, string msg, bool needLogin, string dataStr)
        {
            return new DTO_Res() { code = code, msg = msg, needLogin = needLogin, data = dataStr };
        }

        /// <summary>
        /// 将报表的审核状态转换成字符串
        /// </summary>
        /// <param name="s">审核状态 0未审核 1审核通过 2审核拒绝</param>
        /// <returns></returns>
        public static string Self_BBShenHeStateToStr(int s)
        {
            if (s == 0)
                return "未审核";
            else if (s == 1)
                return "已通过";
            else if (s == 2)
                return "已退回";
            else
                return "未知";
        }

        /// <summary>
        /// 将营业状态转换成字符串
        /// </summary>
        /// <param name="s">营业状态 0营业中 1歇业 2停业</param>
        /// <returns></returns>
        public static string Self_YYStateToStr(int s)
        {
            if (s == 0)
                return "营业中";
            else if (s == 1)
                return "歇业中";
            else if (s == 2)
                return "停业中";
            else
                return "未知";
        }

        /// <summary>
        /// 将报表类型转换成字符串
        /// </summary>
        /// <param name="s">报表类型 1月报 2年报</param>
        /// <returns></returns>
        public static string Self_BBLeiXingToStr(int s)
        {
            if (s == 1)
                return "月报";
            else if (s == 2)
                return "年报";
            else
                return "未知";
        }

        /// <summary>
        /// 将酒店用户类型转换成字符串
        /// </summary>
        /// <param name="s">类型 1主账号 2子账号</param>
        /// <returns></returns>
        public static string Self_JDYHLeiXingToStr(int s)
        {
            if (s == 1)
                return "主账号";
            else if (s == 2)
                return "子账号";
            else
                return "未知";
        }

        /// <summary>
        /// 将酒店用户状态转换成字符串
        /// </summary>
        /// <param name="s">状态 1启用 2暂停 3删除</param>
        /// <returns></returns>
        public static string Self_JDYHZhuangTaiToStr(int s)
        {
            if (s == 1)
                return "已启用";
            else if (s == 2)
                return "已暂停";
            else if (s == 3)
                return "已删除";
            else
                return "未知";
        }


        /// <summary>
        /// 将报表日期转换成字符串
        /// </summary>
        /// <param name="lx">报表类型 1月报 2年报</param>
        /// <param name="dt">报表日期</param>
        /// <returns></returns>
        public static string Self_BBRiQiToStr(int lx, DateTime dt)
        {
            if (lx == 1)
            {
                return dt.ToString("yyyy-MM");
            }
            else if (lx == 2)
            {
                return dt.ToString("yyyy");
            }
            else
            {
                return dt.ToString("yyyy-MM-dd");
            }
        }

        /// <summary>
        /// 将报表的填报日期转换成字符串
        /// </summary>
        /// <param name="zt_tb">填报状态 0待填报 1已填报</param>
        /// <param name="dt">填报日期</param>
        /// <returns></returns>
        public static string Self_BBTianBaoRiQiToStr(int zt_tb, DateTime dt)
        {
            if (zt_tb == 1)
            {
                return dt.ToString("yyyy-MM-dd HH:mm");
            }
            else
            {
                return "";
            }
        }

        /// <summary>
        /// 将日期转换成字符串 
        /// 2000-01-01 转换成空
        /// </summary>
        /// <param name="dt">日期</param>
        /// <param name="isdatetime">是时间格式</param>
        /// <returns></returns>
        public static string Self_RiQiToStr2000(DateTime dt,bool isdatetime)
        {
            DateTime dt2000 = new DateTime(2000, 1, 1);
            if (dt == dt2000)
            {
                return "";
            }
            else if (isdatetime)
            {
                return dt.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                return dt.ToString("yyyy-MM-dd");
            }
        }

        /// <summary>
        /// 将文旅厅用户类型转换成字符串
        /// </summary>
        /// <param name="s">类型 1主账号 2子管理员 3子账号</param>
        /// <returns></returns>
        public static string Self_WLTYHLeiXingToStr(int s)
        {
            if (s == 1)
                return "主账号";
            else if (s == 2)
                return "子管理员";
            else if (s == 3)
                return "子账号";
            else
                return "未知";
        }

        /// <summary>
        /// 将文旅厅用户状态转换成字符串
        /// </summary>
        /// <param name="s">状态 1启用 2暂停 3删除</param>
        /// <returns></returns>
        public static string Self_WLTYHZhuangTaiToStr(int s)
        {
            if (s == 1)
                return "已启用";
            else if (s == 2)
                return "已暂停";
            else if (s == 3)
                return "已删除";
            else
                return "未知";
        }

        /// <summary>
        /// 将文旅厅用户权限转换成字符串
        /// </summary>
        /// <param name="s">权限 1管理权限 2查看权限</param>
        /// <returns></returns>
        public static string Self_WLTYHQuanXianToStr(int s)
        {
            if (s == 1)
                return "管理权";
            else if (s == 2)
                return "查看权";
            else
                return "未知";
        }






    }
}